package org.xxx.epms.sequrity.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.xxx.epms.sequrity.component.*;
import org.xxx.epms.sequrity.service.AdminDetailsService;
import org.xxx.epms.sequrity.util.JwtTokenUtil;

@Configuration
public class CommonSequrityConfig {
    @Bean
    public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); }

    @Bean
    public IgnoreUrlsConfig ignoreUrlsConfig() { return new IgnoreUrlsConfig(); }

    @Bean
    public RestfulAccessDeniedHandler restfulAccessDeniedHandler() { return new RestfulAccessDeniedHandler(); }

    @Bean
    public RestAuthenticationEntryPoint restAuthenticationEntryPoint() { return new RestAuthenticationEntryPoint(); }

    @Bean
    public JwtAuthenticationTokenFilter authenticationTokenFilter() { return new JwtAuthenticationTokenFilter(); }

    @Bean
    public JwtTokenUtil jwtTokenUtil() { return new JwtTokenUtil(); }

    @Bean
    public AdminDetailsService adminDetailsService() { return new AdminDetailsService(); }

    @Bean
    public DynamicAccessDecisionManager dynamicAccessDecisionManager() { return new DynamicAccessDecisionManager(); }

    @Bean
    public DynamicSecurityMetadataSource dynamicSecurityMetadataSource() { return new DynamicSecurityMetadataSource(); }

    @Bean
    public DynamicSecurityFilter dynamicSecurityFilter() { return new DynamicSecurityFilter(); }
}
